﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLogicLayer;
using Resources;
using CommonUtils;

namespace LiveCPEProject.pictures
{
    public partial class Pictures : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Context.User.Identity.IsAuthenticated)
            {
                Response.Redirect("~/login/Login.aspx");
            }
        }

        [System.Web.Services.WebMethod]
        [System.Web.Script.Services.ScriptMethod]
        public static string[] GetUserNameList(string prefixText, int count, string contextKey)
        {
            try
            {
                String[] listUserNames = UserBLL.GetAllUserNames();
                return (from l in listUserNames where l.Contains(prefixText) select l).Take(count).ToArray();
            }
            catch (Exception ee)
            {
                System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame();
                LogWriter.AddLog(ee, LogStatus.Error, GlobalParameters.ApplicationDisplayName, sf.GetMethod().Name);
                throw new Exception(sf.GetMethod().Name + " unexpected error", ee);
            }
        }
    }
}